package com.linkage.jz.bankruptcy.bean;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author AFAP
 * 任务
 */
public class ProTask {
    private String id; // 任务id
    private String bankruptcyProjectId; // 项目id
    private String taskName; // 任务名称
    private String taskContent; // 任务内容
    private String memberId; // 任务执行人id
    private long deadlineTime; // 任务截止时间
    private CommonStatusInfo status; // 任务状态 0-未处理 1-超市未处理 2-已完成
    private long finishTime; // 任务完成时间
    private String feedbackMessage; // 回馈信息
    private UserInfo executor; // 执行人
    private String username; // 执行人姓名
    private UserInfo creator; // 创建人
//    private String username; // 创建人姓名


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBankruptcyProjectId() {
        return bankruptcyProjectId;
    }

    public void setBankruptcyProjectId(String bankruptcyProjectId) {
        this.bankruptcyProjectId = bankruptcyProjectId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public long getDeadlineTime() {
        return deadlineTime;
    }

    public void setDeadlineTime(long deadlineTime) {
        this.deadlineTime = deadlineTime;
    }

    public CommonStatusInfo getStatus() {
        return status;
    }

    public void setStatus(CommonStatusInfo status) {
        this.status = status;
    }

    public long getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(long finishTime) {
        this.finishTime = finishTime;
    }

    public String getFeedbackMessage() {
        return feedbackMessage;
    }

    public void setFeedbackMessage(String feedbackMessage) {
        this.feedbackMessage = feedbackMessage;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public UserInfo getExecutor() {
        return executor;
    }

    public void setExecutor(UserInfo executor) {
        this.executor = executor;
    }

    public UserInfo getCreator() {
        return creator;
    }

    public void setCreator(UserInfo creator) {
        this.creator = creator;
    }

    public static List<ProTask> parse(JsonArray arr) {
        List<ProTask> list = new ArrayList<>();
        for (int i = 0; i < arr.size(); i++) {
            list.add(parse(arr.get(i).getAsJsonObject()));
        }
        return list;
    }

    public static ProTask parse(JsonObject obj) {
        ProTask proTask = new Gson().fromJson(obj, ProTask.class);
        return proTask;
    }

}
